package com.zsrt.java.day20161226.wrl.day161226.demo12;

public class ArrayDemo01 {
	public static void main(String[] args) {
		/*int p1 = 23;
		int p2 = 18;
		int p3 = 16;*/
		int[] ages = {23,18,16};
		
		//数组下标从0开始，ages[i]表示 第 i+1个元素
		int p1 = ages[0];
		System.out.println(p1);

		int len = ages.length;
		System.out.println("len = "+len);
		
		//遍历数组
		/*int value1 = ages[0];
		int value2 = ages[1];
		int value3 = ages[2];*/
		
		for (int index = 0; index <= len-1; index++) {
			int value = ages[index];
			if (index == len-1) {
				System.out.println(value);
				break;
			}
			System.out.print(value+" , ");
		}
	}

}
